import win32gui
import win32print
from win32.lib import win32con
from win32api import GetSystemMetrics


def get_real_resolution():
    """获取真实的分辨率"""
    hDC = win32gui.GetDC(0)
    # 横向分辨率
    w = win32print.GetDeviceCaps(hDC, win32con.DESKTOPHORZRES)
    # 纵向分辨率
    h = win32print.GetDeviceCaps(hDC, win32con.DESKTOPVERTRES)
    return w, h


def get_screen_size():
    """获取缩放后的分辨率"""
    w = GetSystemMetrics(0)
    h = GetSystemMetrics(1)
    return w, h


def screen_scale_rate():
    hDC = win32gui.GetDC(0)
    dpi = win32print.GetDeviceCaps(hDC, win32con.LOGPIXELSX)
    return dpi
